<script type="text/javascript" src="/back/js/plugins/jquery.alerts.js"></script>
<script>
    $(document).ready(function() {        
        $('.confirmbutton').click(function(){            
            var _this = this;
            jConfirm('Вы действительно хотите удалить объявление?', 'Confirmation Dialog', function(r) {
                //jAlert('Confirmed: ' + r, 'Confirmation Results');
                if (r) {
                    window.location.href = $(_this).attr('href');
                }                
            });
            return false;
        });
    })
</script>

<div class="centercontent">
    <div class="pageheader">
        <h1 class="pagetitle">Управление объявлениями</h1>         
    </div>    
    <table cellpadding="0" cellspacing="0" border="0" class="stdtable" id="dyntable">
        <colgroup>
            <col class="con0" />
            <col class="con1" />
            <col class="con0" />
            <col class="con1" />                        
        </colgroup>
        <thead>
            <tr>                
                <th class="head1">Имя</th>                
                <th class="head1">Дата старта</th>
                <th class="head1">Дата окончания</th>
                <th class="head1">Действия</th>                                                        
            </tr>
        </thead>
        <tfoot>
            <tr>                
                <th class="head1">Имя</th>
                <th class="head1">Дата старта</th>
                <th class="head1">Дата окончания</th>
                <th class="head1">Действия</th>                            
            </tr>
        </tfoot>
        <tbody>
                <?php foreach ($this->announcements as $announcement): ?>            
                    <tr class="gradeA">                    
                        <td><?php echo $announcement['title']; ?></td>                    
                        <td><?php echo $announcement['date_start']; ?></td>                    
                        <td><?php echo $announcement['date_end']; ?></td>
                        <td>
                            <a href="/admin/announcement/edit-announcement/announcement/<?php echo $announcement['id']; ?>" class="stdbtn">Edit</a>
                            <a href="/admin/announcement/delete-announcement/announcement/<?php echo $announcement['id']; ?>" class="anchorbutton confirmbutton">Удалить</a>
                        </td>                    
                    </tr>            
                <?php endforeach; ?>
        </tbody>
    </table>  
</div>